package com.igeekhome.shopservice.controller;

import com.igeekhome.shopservice.service.IItemCatService;
import com.igeekhome.shopservice.tree.ItemcatTree;
import com.igeekhome.util.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("tree")
public class TreeController {
    @Resource
    private IItemCatService iItemCatService;

    @RequestMapping("cat/list")
    public ResponseEntity catList(@RequestParam(defaultValue = "0") Long parentId){
        List<ItemcatTree> list = iItemCatService.list(parentId);

        return ResponseEntity.success(list);
    }
}
